import { reactive } from 'vue'
import type { RandomTestingStore } from '.'
import type { InterviewQuestionsSearch } from '@/models/InterviewQuestions/InterviewQuestionsSearch'

export class InterviewQuestionsFormStore {
  constructor(rootStore: RandomTestingStore) {
    this.rootStore = rootStore
  }

  rootStore

  formState = reactive<Partial<InterviewQuestionsSearch>>({
    id: undefined,
    isDeleted: undefined,
    title: undefined,
    answer: undefined,
    classification: undefined,
    secondaryClassification: undefined,
  })

  resetFormState = () => {
    this.formState.id = undefined
    this.formState.isDeleted = undefined
    this.formState.title = undefined
    this.formState.answer = undefined
    this.formState.classification = undefined
    this.formState.secondaryClassification = undefined
  }

  setFormState(formData: Partial<InterviewQuestionsSearch>) {
    this.formState.id = formData.id
    this.formState.isDeleted = formData.isDeleted
    this.formState.title = formData.title
    this.formState.answer = formData.answer
    this.formState.classification = formData.classification
    this.formState.secondaryClassification = formData.secondaryClassification
  }
}
